package com.weaver.qfengx;

import com.google.common.base.Splitter;

import java.util.List;

/**
 * @Description
 * @Author Qfengx <qffg1998@126.com>
 * @Date 2021-08-12 15:31:33
 */
public class TransUtils {

    public static String getLan(String val, int lan) {
        if (StringUtils.isEmpty(val)) {
            return val;
        }
        if (val.startsWith("~`~`") && val.endsWith("`~`~")) {
            List<String> stringList = Splitter.on("`~`").omitEmptyStrings().trimResults().splitToList(val);
            for (String s : stringList) {
                if (s.startsWith(lan + " ")) {
                    return s.replace(lan + " ", "");
                }
            }
            return "";
        }
        return val;
    }

    public static String getLan(String val) {
        return getLan(val, 10);
    }

    public static void main(String[] args) {
        System.out.println(TransUtils.getLan("~`~`7 投行费用`~`8 Investment banking fees`~`~"));
    }

}
